//
//  AppDelegate.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/3/1.
//

import UIKit
import YPBedrock

// MARK: - [AppDelegate]

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    
    /// 渠道来源
    var channel: String {
        var channel = "App Store"
        #if DEBUG
            channel = "Debug"
        #endif
        return channel
    }

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        configNetwork() // 配置网络
        configWatermark() // 配置水印相机相关属性
        configGeneral() // 配置通用属性

        configJiGuang(application, launchOptions: launchOptions) // 配置极光
        configWechat() // 配置微信
        configAMap() // 配置高德
        configUmeng() // 配置友盟
        configRangersAppLog() // 火山埋点
        // 是引导页还是首页
        if let _: Bool = WmcUserdefault.object(forKey: .State.Guide.isShowGuide) { // 有值
            window?.rootViewController = WmcNavVC(rootViewController: WmcHomeVC())
        } else { // 无值
            window?.rootViewController = WmcNavVC(rootViewController: WmcGuideVC())
        }
        
        /// 默认为零，进一次团队相册 + 1
        WmcUserdefault.save(value: 0, forKey: .Tips.Home.enterTeamAlbumCount)
                
        return true
    }

    /// 日志系统
    func appDelegateLog(_ log: String) {
        WmcLogManager.DebugLog(type: .appDelegate, log: log)
    }
}

